export function getMonitorList(id, value) {
    $.getJSON(basePath + "monitor/findAll.html", function (data) {
        let str = "";
        if(value == null){
            for(let index = 0; index < data.length; index ++){
                str += "<option value='"+ data[index].monitorDeviceCode +"'>"+ data[index].monitorDeviceName +"</option>";
            }
        }else if(value != null){
            let selectedArr = value.split(",");
            for(let index = 0; index < data.length; index ++){
                let flag = false;
                for(let item in selectedArr){
                    if(data[index].monitorDeviceCode == selectedArr[item]){
                        flag = true;
                    }
                }
                if(flag){
                    str += "<option value='"+ data[index].monitorDeviceCode +"' selected='selected'>"+ data[index].monitorDeviceName +"</option>";
                }else{
                    str += "<option value='"+ data[index].monitorDeviceCode +"'>"+ data[index].monitorDeviceName +"</option>";
                }
            }
        }
        $("#" + id).append(str);
    });
}